Skip to content

ci: unblock AI-authored PRs (review gate + mention context) - #57

Merged
heskew merged 2 commits into
mainfrom
workflow/ai-pr-review-gates
Apr 23, 2026
Merged

ci: unblock AI-authored PRs (review gate + mention context)#57
heskew merged 2 commits into
mainfrom
workflow/ai-pr-review-gates

Conversation

@heskew

@heskew heskew commented Apr 23, 2026

Copy link
Copy Markdown
Member

Summary

Fixes two gaps that let AI-authored PRs go unreviewed.

1. claude-review.yml — extend author gate to include claude[bot]

The gate used to be author_association in {OWNER, MEMBER, COLLABORATOR}. PRs authored by claude[bot] (our claude-issue-to-pr pipeline) hit author_association: NONE and the review job was SKIPPED. That's how PR #55 landed with no review — the case where review matters most.

Gate is now:

if: >-
  contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'),
  github.event.pull_request.author_association)
  || github.event.pull_request.user.login == 'claude[bot]'

2. claude-mention.yml — inject PR/issue context into the prompt

When Nathan tried @claude review this PR on #55, the mention workflow fired but the agent replied:

I don't see a specific task in this mention. Could you share the PR number or issue that triggered this @claude mention, or describe what you'd like me to do?

The pinned action version isn't reliably surfacing the triggering comment as the prompt. Fix: inline github.event.issue.number || github.event.pull_request.number, URL, target kind, commenter login, and the full comment body directly into the prompt string. Also adds an explicit branch for "if the request is 'review this PR'" that points the agent at .github/review-scopes/universal.md for discipline.

Gate safety (for the review-side change)

  • github.event.pull_request.user.login is set by GitHub from the actual PR author — not user-controlled
  • [bot] suffix is reserved for GitHub Apps; human accounts can't have it
  • App slugs are globally unique on GitHub — claude[bot] is specifically Anthropic's Claude app, which has to be installed in HarperFast to open PRs here
  • Fork-triggered runs have no access to secrets.*, so any hypothetical bypass has read-only blast radius (worst case: a spam comment on a PR, not code execution or secret exfiltration)

Test plan

🤖 Generated with Claude Code

Two gaps, both preventing reviews on AI-authored PRs:

1. claude-review.yml: extend the author_association gate to also allow
   PRs opened by claude[bot] (our issue-to-PR pipeline). The old gate
   skipped the review job entirely — AI-authored code was merging with
   no review, which is the OPPOSITE of what we want. See PR #55 which
   landed unreviewed due to this.

2. claude-mention.yml: inject PR/issue number, URL, kind, commenter
   login, and the full comment body into the prompt. In the pinned
   action version the triggering comment is not reliably forwarded as
   context, so an @claude mention like "review this PR" was producing
   "I don't see a specific task in this mention, could you share the PR
   number?" — the agent had no idea which PR fired the workflow.

Gate safety: github.event.pull_request.user.login is set by GitHub's
auth system from the actual PR author. GitHub reserves the [bot] suffix
for apps and enforces globally unique app slugs, so claude[bot] is
specifically Anthropic's Claude app (which has to be installed in the
HarperFast org to open PRs here). Fork-triggered workflow runs have no
access to secrets regardless, so even a hypothetical bypass has a
read-only blast radius.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@heskew
heskew requested a review from a team as a code owner April 23, 2026 06:39
…n TODO

Review feedback on #57:

1. A single `>` markdown blockquote only marks its first line as
   quoted; subsequent lines render as plain paragraphs. For a
   multi-line @claude request the agent still reads all content, but
   the prompt's visual framing is wrong. Swap to a fenced code block
   so the entire comment body renders as quoted text regardless of
   line count.

2. Add a TODO comment near the inline-injection block so the reason
   it exists doesn't become mystery-cruft six months from now. When
   claude-code-action reliably forwards the triggering comment as the
   prompt, this wrapper can collapse back to supplemental context.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@heskew
heskew merged commit f330fbf into main Apr 23, 2026
4 of 5 checks passed
@heskew
heskew deleted the workflow/ai-pr-review-gates branch April 23, 2026 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant